package com.neusoft.movie.v_movies.activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.neusoft.movie.v_movies.R;
import com.neusoft.movie.v_movies.adpater.EnterActAdapter;
import com.neusoft.movie.v_movies.common.Constants;
import com.neusoft.movie.v_movies.javabean.EnterBean;
import com.neusoft.movie.v_movies.listener.RetrofitListener;
import com.neusoft.movie.v_movies.model.UsersModel;

import java.util.List;

public class MyEnteredActActivity extends BaseActivity implements RetrofitListener {

    RecyclerView recyclerView;
    private ImageView left;
    private int u_id;
    private Context mContext;
    private String result;

    @Override
    void initEvents() {
        left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    void initViews() {
        setLayout(R.layout.activity_my_entered_act);

        recyclerView = (RecyclerView) findViewById(R.id.rv_my_all_act);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        left=(ImageView) findViewById(R.id.left_button);

    }

    @Override
    void initData() {
        SharedPreferences sp=getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        u_id = sp.getInt("u_id",0);
        getMyArticleslist();
    }


    void getMyArticleslist()
    {
        UsersModel usersModel = new UsersModel();
        usersModel.getMyActOrderlist(u_id,this);
    }



    @Override
    public void onSuccess(Object o, int flag) {
        switch (flag) {
            case Constants.GETMYORDERLIST:
                List<EnterActActivity> list = (List<EnterActActivity>) o;
                EnterActAdapter adapter = new EnterActAdapter(this, list);
                recyclerView.setAdapter(adapter);
                break;


        }
    }
    @Override
    public void onFailed() {

    }

}